Subject:
|
Re: R: MIDI and WAV on the RCX
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 4 May 2001 19:32:59 GMT
|
Viewed:
|
1769 times
|
| |
| |
Hi Guido,
Guido Truffelli wrote:
> Hi Stef,
>
> > I've tried your wav2rcx, for some wav files it works nice, but a lot of
> wav files cann't be read.
> I couldn't handle very well the optional "fact" chunks in the WAV file, but
> now I fixed that problem
That's good.
>
>
> > I've made a similar program (very quick and dirty in Delphi) using the pcm-streaming capabilities of windows,
> > so windows does all the decoding for me, and therefore it can read (almost) any wav files.
> > Maybe an idea for your program too.
> Yes, it's a nice idea: however I think that it's much simpler reading WAV
> files directly than using the SDK functions! :-)
Why is that, you've know the complete structure (which I heard can be very different) of a wav file and decode it yourself, or am I missing something ?
>
> and in this way the source code can be compiled on any platform. Sooner or
> later I'll add a GUI to both *2RCX programs, but maybe it will be only a
> frontend to the command line utilities (like RCXCC and NQC).
That's great intention !
and too difficult for me.
>
>
> > As we discussed a few months ago, you use real FFT, where I use simply
> zerocrossing detection.
> I gave a look to your sources, but of course I couldn't understand your
> algorithm :-)
> If it's a simple thing, can you explain me how it works briefly?
I'll try,
first the frequency:
You divide the time signal in evenly sized chunks of say 20 msec,
then you count the number of times the timesignal goes through the zero-line (the mean) in a chunk,
and then the dominant frequency in that chunk is simply: Frequency = NZero / Chunksize.
In my program I have to divide by 2, because I count both positive and negative transistions.
To get ride of the noise I've added a little hysteresis to the zero-crossing.
then the power,
I just calculate the standard deviation of the signal (which is equal to the RMS value of the AC component) in each chunk.
The standard deviation can be calculated in the following way:
sum all the samples in one chunk, that is x1 = x1 + x(i) (where x(i) is the sample)
sum the square off all samples, that is x2 = x2 + square ( x(i) )
standard deviation = x2 / n - square (x1 / n) (where n is the number of samples over which x1 and x2 were calculated)
>
>
> > I've compared the results of both programs on laser.wav, here are the results:
> > The frequencies of your program are added as comment, nice resemblance,
> not ?
> Yes, they are very similar for laser.wav. Why do you round the resulting
> frequencies to multiples of 25?
Good notice !
I didn't notice it, but it's of course very logical,
I can have only an integer number of zeroes per chunk, so
chunks of 20 msec gives multiples of 50 Hz
chunks of 10 msec gives multiples of 25 Hz etc
>
> I made some experiments on ghost.wav (now I can read it!) and I noticed that
> your program gave much better results than mine, i.e. the resulting RCX
> sound seemed much closer to the original. So I began exploring some way to
> improve my code and at 1:00 AM I found a very simple modification that gives
> even better results!
> I'll try it on other samples and if it continues to perform well even when
> I'm not sleeping, I'll release a new version of wav2rcx.
I'm curiuous, I my self found the results very poor off all programs.
I'd like to hear your results, could you make a wav recording from the RCX brick, that would be nice to promote your program and I and others will know what they have to hear..
>
> > I think, if you want to improve sound, you have to do something with
> ampltude, for instance by substituting pauzes in it (you can do it with my
> program, it has a minimum level, below which it substitutes pauzes in stead
> of tones), If you'd like to try it,
> WAV2RCX generates pauses for frequencies below 32 Hz, but I'll try also to
> ignore low energy ones too: great idea!
>
> > I've put executable and sources in an self-extracting zip-file. It also contains a file
> > ghost.wav which can not be translated with your program.
> Thank you very much for providing the file, so that I could fix the bug.
>
> > At the moment I'm busy with other things, but sounds have still my interest, so if you come with something new,
> > I'd like to here form you.
> Of course ... stay tuned :-)
>
> Hi, Guido
succes !
Stef Mientki
|
|
Message is in Reply To:
| | R: MIDI and WAV on the RCX
|
| Hi Stef, (...) wav files cann't be read. I couldn't handle very well the optional "fact" chunks in the WAV file, but now I fixed that problem (...) pcm-streaming capabilities of windows, (...) (almost) any wav files. (...) Yes, it's a nice idea: (...) (24 years ago, 3-May-01, to lugnet.robotics)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|