chjmartin2 Posted February 27, 2012 Author Share Posted February 27, 2012 I can tell you one thing that won't work. I tried to use a noise reduction filter by taking the noise from the output of the 1,0,1,0,1,0,1,0 and using a noise reduction filter on the input sound before I processed it. What I got was a sample that sounded underwater, when I ran that through the converter, I got a sample that sounded underwater with noise! Ha! Quote Link to comment Share on other sites More sharing options...
intvnut Posted February 27, 2012 Share Posted February 27, 2012 (edited) Interesting asymmetry there on your triangle wave. When the signal's decreasing, there's that bit of thrashing right after the triangle goes below 0. I wonder if there's a problem in the SDM computation? I'm going to try a triangle right now and see for myself in my own sdm code... Ok, so I put my own SDM to the test and constructed this striking picture: So at least my code's doing OK. (The blue/black in the background indicate whether the SDM output is 0 or 1, and the white is the triangle wave I fed it.) Here's the C program: #include < stdio.h > #include < stdlib.h > #define NSAMP (128) #define OSAMP ( short i_data[NSAMP]; unsigned char o_data[NSAMP*OSAMP]; int main() { int i, y, x; FILE *f; for (i = 0; i < NSAMP/2; i++) { i_data[i ] = -32767 + 65534*i / (NSAMP/2-1); i_data[i + NSAMP/2] = 65536 - i_data[i]; } sdm(i_data, o_data, NSAMP, OSAMP, 32767); f = fopen("foo.ppm", "wb"); fprintf(f, "P6\n%d 512 255\n", NSAMP * OSAMP); for (y = 0; y < 512; y++) { int hi = 32767 - y * (65536/512); int lo = 32767 - (y+1) * (65536/512); for (x = 0; x < NSAMP * OSAMP; x++) { i = x / OSAMP; if (i_data[i] <= hi && i_data[i] >= lo) { fputs("\377\377\377", f); } else if (o_data[x]) { fputs("\070\070\377", f); } else { fputs("\001\001\001", f); } } } fclose(f); return 0; } It wrote the image you see above as a PPM file -- nothing terribly crazy. You might want to check the output of your SDM converter directly just to make sure it looks nice and clean like this on both halves of the triangle. Edit: The AA comment software really doesn't like things in angle brackets even if they're in a code block. Annoying. Edited February 27, 2012 by intvnut Quote Link to comment Share on other sites More sharing options...
intvnut Posted February 27, 2012 Share Posted February 27, 2012 This looks bogus: audio(j)=audio(j)+4000*rnd-2000 Since you declare 'audio' as short, what's to stop the random noise you're injecting from overflowing the 16-bit range? I'd try taking the dithering out altogether. SDMs naturally dither. Have you tried it without your stochastic dither now that we've cleaned up the bit-banging loop? Quote Link to comment Share on other sites More sharing options...
chjmartin2 Posted February 27, 2012 Author Share Posted February 27, 2012 I am pretty convinced that the converter is working properly. The output I showed you was from the Aquarius. I also have Square Wave Audio Files that I put out. Here is the output of the converter as a Square Wave played directly. Jungle_SDM_Out.wav Quote Link to comment Share on other sites More sharing options...
chjmartin2 Posted February 27, 2012 Author Share Posted February 27, 2012 This looks bogus: audio(j)=audio(j)+4000*rnd-2000 Since you declare 'audio' as short, what's to stop the random noise you're injecting from overflowing the 16-bit range? I'd try taking the dithering out altogether. SDMs naturally dither. Have you tried it without your stochastic dither now that we've cleaned up the bit-banging loop? Good Catch, the dither has been turned off for a while so that we can hear what the converter itself is doing. I can always add dither back to mask the "swish/swish" noise left over, but you are right that I would have to clip check if I were doing that. Quote Link to comment Share on other sites More sharing options...
intvnut Posted February 28, 2012 Share Posted February 28, 2012 One add'l thought on the dither: Rather than adding random noise to the samples, why not just add the random noise to the cumulative error term? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.