*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Engine Acceleration sounds best with change in pitch
« on: July 28, 2018, 08:14:42 AM »
made some audacity files trying to match the Benedini and improve the Taigen sounds.  There is an obvious correlation between throttle stick position and playback speed. This accelerated playback usually sounds terribly electronic (whether a linear speed change algorithm or accessing WAV files at certain throttle points). However, by changing pitch -5% or so for every ~50% increase in playback speed to a certain point (60-70% of full throttle). There is now a very nice engine sound. This works better at the lower 'rpm's' than the higher ones because natural engine frequency increases at higher rpm's.  So pitch delta would have to be increased, then decreased as rpm increases. This could be linear to make it easier.  See pic.

I have tried to included my audacity WAV sound files from a basic diesel engine idle to 200% idle speed.    Unfortunately, I could not post the WAV files so I made a youtube vid of each. Sounds better live. Had to record on vid for youtube as my vid editor would not import WAV file into blank video. And my desk is dusty.. :(

Another important point is overlap. Overlap in idle and throttle up, revving to throttle down, throttle down to idle, etc.....The issues regarding sound card multi track playback have been discussed.

No change in pitch:


Chnage in pitch:


Pitch image.JPG
Engine Acceleration sounds best with change in pitch Pitch image.JPG
Views: 66
« Last Edit: July 28, 2018, 07:04:53 PM by XRAD »

*

Offline Shorty54

  • 39
    • View Profile
  • MN, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #1 on: July 28, 2018, 07:49:31 PM »
I find making the sounds very difficult :o  I think it takes hrs of practice to make one good sound file, let alone, a whole tank sound system.  You should be able to share the WAV in a zip file.  Thats how I have posted them before.  Im far from being computer savy ;)

Enjoy,
Shad

*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #2 on: July 29, 2018, 07:35:46 AM »
OK , Thx Shad. trying zip file. Here is Jagdpanther HL230 decel idle accel decel clip I made up. Altered to mono 16 bit and amplified to -4 to -6dB.  And there is overlap, fade, and pitch change as needed.  Took 10min to make so not the best, but you get the idea.  The hard part is not editing the sound files to get same levels and clarity and density, but actually getting a good recording to start with. I added an 88mm firing at the end....

Now this is good for sound 'bites' but not for the throttle sound. to match the throttle stick position, the acceleration algorithm has to be somewhat linear, changing playback pitch and speed as needed (perhaps 10 times , or infinitely,  min to max throttle) to match the stick.  I don't think that using multiple sound bites throughout the throttle range is the best option. Using a baseline acceleration clip to overlap with the linear acceleration sound pattern will hide some of the digital sound. But the throttle sound will have to be a combination of increased playback speed and pitch change for best sound.

Or you would need a separate 'sound generator' just for throttle up-down positions, but this gets to be a bit much.
*
HL230 decel idle accel decel.zip
(1006.53 kB ~ Downloads: 13)
« Last Edit: July 31, 2018, 07:50:49 PM by XRAD »

*

Offline Shorty54

  • 39
    • View Profile
  • MN, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #3 on: July 29, 2018, 01:04:32 PM »
I think it sounds good through my PC.
I might run it through the Tamiya speaker via the TBS mini and see how it sounds.

Shad

*

Offline LukeZ

  • 524
    • View Profile
  • Kansas, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #4 on: August 01, 2018, 04:34:18 PM »
Hi Rad, was away for several days but finally getting caught up again on the posts here. Your sound experiments are interesting to follow and I thought your JP sounds were quite nice.

You mentioned the difference between using multiple sound bites for throttle speed compared to a baseline engine sound dynamically adjusted for playback speed and pitch. As you know the Open Panzer sound card is using the individual sound bites approach, because it is difficult for a microprocessor to stream digital sound data from the relatively slow SD card, manipulate the data and then convert it to analog at the necessary speed. Computers can do this easily but computers are running their CPUs at much higher frequencies. Benedini seems to have managed it but his firmware is closed so I don't know what his specific approach is, but there are two things we do know - he stores sound clips essentially in RAM, which while very fast is also very limited in space; so this requires his clips to be very short and of low quality. Although I am impressed at his technical achievements I am not always a fan of the sound that can be generated.

But I agree with you the individual sound bite approach can sound even worse, especially when the sound clips are very brief. This causes the broken-record effect which always makes me want to commit suicide, I'd rather have a completely silent model than hear that.

The best RC models are a combination of technical and artistic elements. Trying to literally re-create the precise sound of a real life engine through an electrical device that is not an engine will be a less effective approach than emulating the "spirit" of the sound creatively. In my view using long samples create a far more believable effect even if there is not much pitch change with engine speed, because the artificiality of the pitch changes we are able to generate with the limitations we have are more likely to break the sense of immersion than something more seamless even if less precisely "realistic." The best modelers create the illusion of reality through more simple means, rather than trying to literally copy reality.

I think your JP sound set, with the addition of a single relatively long running sample (to avoid the broken record effect) would sound one million times better than most anything else on the market today even though in effect it would only have a single throttle speed (apart from idle). Good accel/decel sounds and smooth transitions are more important to realism in my view.

Anyway those are some of my thoughts but I think model sounds are highly subjective and what sounds good to one person may not to another.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #5 on: August 03, 2018, 09:55:51 PM »
Hi Luke.

Agree with everything you said.  Taking the 'stepped throttle' approach, the best sound to my ear is by adding a subtle delay/overlap between steps. For example, a  .2 second overlap as you go from one file to the next sound works well.  Not sure how many steps you would plan,  but these engines did not rev too high, so you could get away with 5-10 steps.  Below is visual of the blended soundtrack I made above, and then the highlighted section in second pic is .2 sec of overlap between idle change to throttle up.  I added a fade-out to end of the idle bite, and a fade-in to the throttle up sound bite.  Each bite has a ~.2 sec fade-in at beginning, and a fade-out at end .

You would have to plan to play each sound bite a fraction of a second longer after stick position change, latch the sound, as the new sound bite plays.  Now, I would think that idle, since it is probably going to be in a loop , can't have the fade-out effect.  Therefore, how to hide the broken record.   The sound track can be developed so that the the milisec delay on repeat can be buried into the track on a backfire or intermittent 'tick' AND can be better hidden by two overlapping idle tracks.  One can be longer than the other so that there is aliasing of the sound 'breaks.' I have made loops for WT588D chip and you really can't hear the break when I hide it. But I do not know the access speed of your set-up.

However, you can't put a hard fade into the sound bites as they would end up playing if the throttle position is held longer than the sound bite.  Therefore, you would have to write into the program a way to add a .2 sec fade-in and fade-out(could be by amplification) to each bite while latching the ending bite and playing the new bite.

Or forget the fade in/out and just use the latch-delay-overlap method.

Also, you may want to add an overall throttle up delay. By this I mean that the engine can only accelerate so fast. So that all throttle steps have to play sequentially (at least for a minimal amount of time) to get to full speed, rather than skipping steps to match stick position. this is more realistic.  Similar delay on throttle down as the stick returns . Only go to decel sound bite if stick returns to center.

Playback delay-overlap is going to be key here.   

So now this gets more complex in the programming. I still think you can create a throttle specific sound generator with pitch change just to fill the gap during accel and decel.  And overplay it with good idle and full throttle and decel sounds.  I have one of these and it does not sound too bad for 20$.

https://www.ebay.com/p/RC-Car-Truck-Engine-Sound-Module-Accelerator-Linkage-Sound-Set-10-Kinds-Sounds/628225464?iid=123008845993&chn=ps

 I think is a stepped generated sound and not stepped bites because it is the same rhythm different pitch and speed for 10 different engines. Or it could be stepped bites with pitch/speed change??  One of the sounds is pretty good and I use it in my defender.  You can hear it here:


HL sound merge.JPG
Engine Acceleration sounds best with change in pitch HL sound merge.JPG
Views: 41
HL overlap.jpg
Engine Acceleration sounds best with change in pitch HL overlap.jpg
Views: 43
« Last Edit: August 03, 2018, 10:22:31 PM by XRAD »

*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #6 on: August 04, 2018, 07:43:22 AM »
It would be nice to just swap an SD card, but I think that flash memory is easy to use too.  Cable vs card. Still have to plug something in.  Or, another solution! you can use both SD  and Flash. Flash for throttle/idle/accel/decel and SD for everything else. That way you can maintain a background engine sound and overplay with MG cannon voices etc...and keep the design pretty simple, and use a micro SD socket for all the non-engine sounds.

OK did some more testing. Using the WAV files for my decel and idle, I loaded them to a WT588D (see below).  The Wt has 10-40msec transition and a built in fade which helps smooth the sound. I did not add fade in or out to the base sound files. Here are WT588D specs (cost 2$!!) and you can easily add 10 throttle transition steps up and down, decel, idle, and full throttle, and run it in serial mode:

http://radiocom.dn.ua/image/data/pdf/WT588D_WT.pdf

http://www.ars-informatica.ca/eclectic/programming-the-wt588d-sound-module-part-3-three-line-serial-mode/

And there is the version with built in programmer module :
http://www.icstation.com/wt588d-voice-sound-module-mini-interface-32mbit-sound-speaker-module-8ohm-voice-playback-module-p-13084.html

There are a few good SPI controlled sound cards. Adafruit has several WAV shields (control via atmega328 vs 128 however).  I have used several of ladyada's FX sound boards and they are very fast and easy to program. I think that the playback hardware is out there now.  Serial control and ease of use by general population is the only issue.

I love this board too(but it does not run a background sound and only plays one sound at a time). It reads memory very fast and the sound quality and amp section are fantastic:
http://www.thecustomsabershop.com/Blaster-Core-Sound-Module-V5-P1182.aspx

With audacity, you can make good sound files and save to 16Hz wav mono. The resolution on audacity allows for creating/identifying  subtle breaks in the sound bite where needed.  Definitely needs an external amp as the built in amp is only 0.5watt or something.

My 9 second sound idle sound bite in loop. smooth transition at 1 sec, 9 sec, 19 sec in first vid.  My sound bites in series in second vid. You can hear the transition, but you can't discern an audible gap in the transition:

LOOP:
feature=youtu.be

SERIES:
feature=youtu.be






wt588d programmer.JPG
Engine Acceleration sounds best with change in pitch wt588d programmer.JPG
Views: 42
fine resolution of sound.JPG
Engine Acceleration sounds best with change in pitch fine resolution of sound.JPG
Views: 40
« Last Edit: August 05, 2018, 08:08:55 PM by XRAD »

*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #7 on: August 04, 2018, 10:32:24 AM »
So I am going to try this as time allows:

servo signal (throttle up/down)  TO ('pwm' decoder? if needed) TO adafruit feather express(or arduino AVR or whatever processor I can find in my spares box) TO wt588D TO amp. OR I might use adafruit FX 16mb board if I can find mine. Adafruit hardware and arduino code/libraries is fairly easy to work with.

So there is a bit of code to figure out as the chinese instructions example code is limited for the wt588d. I can use something like this (happens to be for a light saber but same idea). Just need to set up the servo signal interface. The WT588D_Send_Command(byte address) can be used for sound track playback and defined in the wt588d.h . Its going to take a bit of time to get it sorted.  I need to get a few of the wt588d-u :

Code: [Select]
#define WT588D_SDA 0 //Module pin "P03" or pin # 10
const int xpin = A0;                  // x-axis of the accelerometer
const int ypin = A1;                  // y-axis
const int zpin = A2;                  // z-axis (only on 3-axis models)
int oldtime;
int newtime;

void setup() {
  pinMode(WT588D_SDA, OUTPUT); 
  oldtime = analogRead(xpin) + analogRead(ypin) + analogRead(zpin); //establish a baseline read for the ADXL

void loop()
{
delay (50);
newtime = analogRead(xpin) + analogRead(ypin) + analogRead(zpin);
 
if
  (newtime - oldtime >= 40 || newtime - oldtime <= -40 ) // if there was movement...
 {
  WT588D_Send_Command(2); // Play swing sound
  delay (200); // wait a tick
}
  else
  {
  delay (20); // wait a tick
  }
 oldtime = analogRead(xpin) + analogRead(ypin) + analogRead(zpin); // sample the new movement of the ADXL
 delay(10);
 Serial.print(oldtime);
 Serial.print("\t");
 Serial.print(newtime);
 Serial.print("\t");
 Serial.print(newtime - oldtime);
 Serial.println();
 
 delay (50);
 }

void WT588D_Send_Command(byte addr) {
    digitalWrite(WT588D_SDA, LOW);
    delay(5);

    for(int i = 0; i < 8; i++)  {
        digitalWrite(WT588D_SDA, HIGH);
        if(bitRead(addr, i)) {
            delayMicroseconds(600);
            digitalWrite(WT588D_SDA, LOW);
            delayMicroseconds(200);
        } else {
            delayMicroseconds(200);
            digitalWrite(WT588D_SDA, LOW);
            delayMicroseconds(600);
        }
    }
    digitalWrite(WT588D_SDA, HIGH);
    delay(100);
} //end WT588D_Send_Command


wt588d.h:

#ifndef _WT588D_H_
#define _WT588D_H_

#include <Arduino.h>

#ifdef __SAM3X8E__
typedef volatile RwReg PortReg;
typedef uint32_t PortMask;
#else
typedef volatile uint8_t PortReg;
typedef uint8_t PortMask;
#endif


class WT588D {
   
 public:
    WT588D(uint8_t resetPin, uint8_t chipSelectPin, uint8_t serialClockPin,
           uint8_t serialDataPin, uint8_t busyPin);
   
    void  begin(void);
   
    void    setVolume(uint8_t volume);
    void    playSound(uint8_t playListNumber);
    void    startLoopSound(void);
    void    stopLoopSound(void);
    boolean  isBusy(void);
   
 private:
    int8_t rstPin, csPin, sclPin, sdaPin, bsyPin; // pin numbers
    PortReg *csport, *sclport, *sdaport, *bsyport;
    PortMask cspinmask, sclpinmask, sdapinmask, bsypinmask;

    boolean  waitForBusy(uint32_t timeout = 200L);
    void     sendCommand(uint8_t cmd);
};

#endif // _WT588D_H_
« Last Edit: August 05, 2018, 01:06:43 PM by XRAD »

*

Offline LukeZ

  • 524
    • View Profile
  • Kansas, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #8 on: August 04, 2018, 12:16:20 PM »
Taking the 'stepped throttle' approach, the best sound to my ear is by adding a subtle delay/overlap between steps. For example, a  .2 second overlap as you go from one file to the next sound works well.
This is the approach I've already taken, the sound card uses a 0.4 second overlap but it can be adjusted. Either way it needs to remain brief. In my implementation they don't only overlap, but during the brief overlap time the first sound is faded out the same rate the second sound is faded in, this keeps the overall volume level the same.

Not sure how many steps you would plan,  but these engines did not rev too high, so you could get away with 5-10 steps.
There are 10 steps programmed for now.

Also, you may want to add an overall throttle up delay. By this I mean that the engine can only accelerate so fast. So that all throttle steps have to play sequentially (at least for a minimal amount of time) to get to full speed, rather than skipping steps to match stick position. this is more realistic.  Similar delay on throttle down as the stick returns . Only go to decel sound bite if stick returns to center.
Something like this has been implemented, at least on deceleration, but it is actually taken care of on the TCB side. You can see it in action by setting the sound card to type Benedini and then attaching a servo to the Prop1 output. The servo will pretty much mach your throttle stick as you accelerate but when you return the stick to center the servo will take longer to return. In real life you can rev the engine pretty much instantaneously but it doesn't return to idle instantaneously if you let off the gas. Of course the OP sound card doesn't use the Prop 1 output but the TCB logic in this regard is the same no matter which sound card is being used.

As for acceleration, the OP sound card will not strictly require every step to be played sequentially, but unless you gun it all at once it will at least play each step for the length of the fade time discussed above.

I still think you can create a throttle specific sound generator with pitch change just to fill the gap during accel and decel.  And overplay it with good idle and full throttle and decel sounds.
Technically I think this is possible with the hardware we have but it is not something I've pursued yet at this point. I'm not sure if it would detract fro good quality sounds, and also, there is a limit to how many sounds can be played at once.

As for your other comments about using both Flash and SD,etc... the hardware parameters on my design are pretty much settled at this point, but these are all good ideas for others who may wish to develop alternative versions.

This thread is an interesting collection of experiments and not really related to the design I'm working on so I'll quit butting in with comparisons to what I've done. Keep going with your explorations and I'll be curious to see where it leads you.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #9 on: August 04, 2018, 01:01:40 PM »
Thx Luke,  tell me I am wasting time, it's OK.  I just read through your code on Github:

Code: [Select]
     if (FX[i].SDWav.isPlaying() && (FX[i].SDWav.positionMillis() >= (FX[i].soundFile.length - TRACK_OVERLAY_FADE_TIME_MS)))
                    {   
                        FadeRepeatOverlaySound(TrackOverlaySound[GetOverlaySoundNumBySpeed()],TO_TR_KEEP_MOVING);    // Fade in and start repeating
                    }
                    break;
and your track 'mixing'   code...

and the 2 track engine sounds so no 'break' in the loop

You already have all this!  Glad I was only starting my UNO code!

10 accel/decel segments should be more than enough. I counted only maybe 4-5 on the Benedini.  The only thing I notice w/ SD card playback is the 'break' during loops. this would happen anytime the stick position is maintained longer than the playback time on accel decel sound files...such as holding mid throttle.  So if stick maintained for (x)millis, you may consider that another track of same level throttle sound is faded in and overlapped before the baseline mid throttle file is completed, and they would just repeat until throttle change.   So for every throttle position that is not idle or full throttle or the return to stick neutral decel sound, there has to be x2 tracks of same rpm sound.   Unless, you can access a file again while it is playing so that the data can be preloaded into a buffer. 

One other thought was using an interrupt to processor to identify 'pwm' delta throttle and save on processing loops.  Not sure if this is needed w/sbus.......

*

Offline LukeZ

  • 524
    • View Profile
  • Kansas, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #10 on: August 04, 2018, 05:54:33 PM »
The only thing I notice w/ SD card playback is the 'break' during loops. this would happen anytime the stick position is maintained longer than the playback time on accel decel sound files...such as holding mid throttle.  So if stick maintained for (x)millis, you may consider that another track of same level throttle sound is faded in . . . Unless, you can access a file again while it is playing so that the data can be preloaded into a buffer.
Yes, we can read the same file more than once so for a sound that is on continuous repeat we can fade back into itself when it ends, and we always have two slots dedicated to engine sounds for this reason. That is already implemented in several places but I may have missed a place or two as in the case of a repeating mid-throttle position, but it's easy to add it and I'll go back and review and make sure all the cases are covered.

PS: If you want to include code in your post you can wrap it in [code] .... [/code] tags so it formats correctly, I did this for you above.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #11 on: August 14, 2018, 01:20:12 PM »
Luke , I know you are decided on hardware. Not trying to switch your mind here but I am experimenting with Teensy 3.2 serial control of Robertsonics tsunami(3.3v logic). The tsunami is wayyyyy more powerfull than we would ever need for an RC tank or car, but maybe not for an animatronic figure or robot or other interactive purpose. It can play 32 C10 micro SD wav tracks at same time with built in level matching, fade, and pitch control.  His old wav board had a built in amp, this one does not. It is a bit on the large size at ~8x8cm and relatively expensive(could be made smaller easily by eliminating the numerous analog inputs and outputs).  There is only 10-15msecs delay before track play.  The robersonics old wav board is half the price and a bit smaller, and is polyphonic too...but lacks some of the new Tsunami functions.  Plenty of free control code for the robersonics boards available. 

*

Offline LukeZ

  • 524
    • View Profile
  • Kansas, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #12 on: August 15, 2018, 09:16:46 PM »
Those are very interesting devices I had not seen before. Not really practical for the mass market for several reasons as you point out, but certainly for people willing to experiment they give you a lot of capability to play with.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs

*

Offline XRAD

  • 26
    • View Profile
  • Ohio, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #13 on: August 18, 2018, 09:45:26 AM »
Luke, I spent a few hours revisiting 15 files of your sound card code. You have designed an all inclusive set-up and have control for just about every major factor I can think of. I really like the non-repeat sound sections, and the test routines.  Although I did see (-1) no play last played track, I did not see a [random()] sound call/function. Since you have so many sound .wav for engine at each step, and squeaks, this might be a neat addition (as a GUI selection).  Or maybe it's in the code and I missed it...

One other thought would be to add into the OPTCB sound GUI a way to look at the .wav SD files so that you could test/play each one individually (not necessarily sending .wav back through the OP sound board serial connect to laptop speaker, but output via the Sound board amp and speaker, similar to the sequential play in test routine, instead selecting one track at a time).  Although playing all tracks in a row with small delay is helpful to test them (w/the ground pin 1 on startup), it is hard to keep track of which file is which sound without a visual representation of the SD card contents. So when the SD card is inserted into the OP sound board, it might be a cool option to see the files and play each one (and it would be another distinction for your sound board over any other).

Anyway, great job!!  Will definitely purchase when complete!

*

Offline LukeZ

  • 524
    • View Profile
  • Kansas, USA
Re: Engine Acceleration sounds best with change in pitch
« Reply #14 on: August 18, 2018, 05:05:32 PM »
The random sound feature is one I am currently working on, there might be partial code for it on GitHub I can't remember, but it is not quite done yet. The general approach I am taking for now is to provide two sound "banks" of up to 20 sounds each, then there will be options to play next, play previous, play random, etc... Basically sort of like the same functionality of an MP3 player. If you want to play a specific sound you would use the User Sound option and call that specific sound directly. But if you just want a collection of music that you could cycle through, or call at random, the sound bank will work for that.

As for you other suggestion, if you run the test routine with the sound card connected in Snoop mode it will show the name and duration of each sound file as it is being played. In fact even if you are not in the test routine and you connect in Snoop the sound card gives a lot of diagnostic information. It's not really needed for normal operation but I use it for debugging and such. At present you can't tell it to play a sound from the GUI interface, but you can of course tell it to play a sound from the TCB or from your RC transmitter and then see that displayed in the console.
NO SUPPORT THROUGH PM - read why
Open Panzer FAQs