sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: Cedric Roux <sed@free.fr>
To: sox-devel@lists.sourceforge.net
Subject: Re: dev request
Date: Mon, 09 Sep 2013 16:13:58 +0200	[thread overview]
Message-ID: <522DD7A6.1010500@free.fr> (raw)
In-Reply-To: <DAF8C289-9F20-4A66-8AD5-8508539B4C16@muzikliberated.com>

[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]

On 09/08/2013 11:08 PM, Brad Holland | Muzik Liberated wrote:
> Hey Guys,
> Since you are sox developers we thought that you may well be the best people to talk to.
> We are looking for a small script (perhaps using sox) that scans a raw audio file and applies some modulation to the audio file which amplifies the content at specific points (when the signal is lower than -6db) and  continues to do this every time the sound does this throughout its decay.
>
> This is to combat 8-bit sample artifacts when creating custom roms for a  drum machine. (Alesis HR-16). There is a special ASIC chip in this machine that detects a 6db spike in a waveform and the chip then turns down the gain -6db in essence, by keeping the amplitude of the waveform above the noise floor inherent in an 8-bit audio data you are able to achieve much higher fidelity in short decaying 'drum shot' type sounds.
>
> We are a community of enthusiasts for the machine, although none of us could code anything like this. We'd be willing to pay/donate to the project or an individual to knock us up a bit of code to convert this..
>
> A much more in-depth explanation of the process we need to accomplish is written in this post:http://www.burnkit2600.com/diy-sound-roms/
>
> If someone is interested in helping us with this please get back to me!
>
> Cheers
> Brad

Hi Brad,

attached hack might do the trick.
If not, tell me, I'll have a closer look,
there might be bugs in there (just a quick
and dirty hack).

You can compile it, right? If you're using
windows you may need to change stuff in there
to handle binary files correctly.

Anyway, just tell me if something is wrong, whatever it is.

Regards,
Cédric.

[-- Attachment #2: christmas.c --]
[-- Type: text/x-csrc, Size: 1374 bytes --]

#include <stdio.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <math.h>

int main(int n, char **v)
{
  char *infile;
  char *outfile;
  FILE *f;
  struct stat s;
  float *data;
  float *max;
  ssize_t size;
  ssize_t i;
  float gain;
  int up;
  float last;

  if (n != 3) {
    printf("gimme <input float mono file> <output float mono file>\n");
    return 1;
  }

  infile = v[1];
  outfile = v[2];

  if (stat(infile, &s)) { perror(infile); return 1; }
  size = s.st_size;

  data = malloc(size * sizeof(float)); if (data == NULL) abort();
  max = malloc(size * sizeof(float)); if (max == NULL) abort();

  f = fopen(infile, "rb"); if (f == NULL) { perror(infile); return 1; }
  fread(data, size, 4, f);
  fclose(f);

  max[size-1] = fabsf(data[size-1]);

  /* populate max */
  for (i = size-2; i >= 0; i--) {
    float m = fabsf(data[i]);
    if (m > max[i+1]) max[i] = m; else max[i] = max[i+1];
  }

  /* apply gain */
  gain = 1;
  up = 1;
  last = data[0];
  for (i = 0; i < size; i++) {
    data[i] *= gain;
    max[i] *= gain;
    if (up == 0 && data[i] > last) {
      /* local minimum */
      if (max[i] <= 0.5) gain *= 2;
    }
    if (data[i] > last) up = 1;
    else if (data[i] < last) up = 0;
    last = data[i];
  }

  f = fopen(outfile, "wb"); if (f == NULL) { perror(outfile); return 1; }
  fwrite(data, size, 4, f);
  fclose(f);

  return 0;
}

[-- Attachment #3: Type: text/plain, Size: 433 bytes --]

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk

[-- Attachment #4: Type: text/plain, Size: 158 bytes --]

_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

  parent reply	other threads:[~2013-09-09 14:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08 21:08 dev request Brad Holland | Muzik Liberated
2013-09-08 23:28 ` Eric Wong
2013-09-09 14:13 ` Cedric Roux [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-08 21:11 Brad Holland | Muzik Liberated

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=522DD7A6.1010500@free.fr \
    --to=sox-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).