Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 15 FirstFirst 1 2 3 4 12 ... LastLast
Results 26 to 50 of 358

Thread: Play RAW from Serial Flash

  1. #26
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Hi Frank

    Just implementing flash playback but can't find spi_flash.cpp / .h anywhere!!!

    searched your code repository, searched Audio code repository, no joy. I have the latest github repository syncing to my arduino folder, has this file been renamed?
    I've searched the audio thread and there are numerous mentions of this mysterious beast.

    conclusion: I am doing something stupid. again.

    Can you throw me a clue please?

  2. #27
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Also, wav2raw.exe doesn't run on 64bit windows 7

    Click image for larger version. 

Name:	wav2rawerror.jpg 
Views:	73 
Size:	43.9 KB 
ID:	3300

  3. #28
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    Quote Originally Posted by Pensive View Post
    Hi Frank

    Just implementing flash playback but can't find spi_flash.cpp / .h anywhere!!!

    searched your code repository, searched Audio code repository, no joy. I have the latest github repository syncing to my arduino folder, has this file been renamed?
    I've searched the audio thread and there are numerous mentions of this mysterious beast.

    conclusion: I am doing something stupid. again.

    Can you throw me a clue please?
    Ehhm... there is no spi_flash needed... (?!?)
    Ok, the flashing tool needs flash_spi.h (<-read! ), which is in the arduinio/libraries/audio folder

    Your screenshot: Hmm.. funny, i use it on windows7 64 bit :-((
    I look at this tomorrow.

    Then, there seems to be a problem with AudioStartUsingSPI() and AudioStopUsingSPI ... if playing does not work for you, comment it out in the lib for the moment. Just found this issue some minutes ago.
    Tomorrow is the 13th... is this a sign ?

  4. #29
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    Unsupported 16 bit Application (?)
    Funny screenshot...

  5. #30
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    Could you try both versions from the attachment,please ?

    I'll try to run it at work, tomorrow, maybe i can find the issue.

    Paul, do you have an idea ?
    Attached Files Attached Files

  6. #31
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Quote Originally Posted by Frank B View Post
    Ehhm... there is no spi_flash needed... (?!?)
    Ok, the flashing tool needs flash_spi.h (<-read! ), which is in the arduinio/libraries/audio folder
    no it isn't; I wrote it the wrong way round (sorry ) but it is not there in github, which is what I am synced to. Therefore not in my arduino folder.
    https://github.com/PaulStoffregen/Audio

    i even logged out of github in case it was due to my login., still no flash_spi or spi_flash files at all.

    Quote Originally Posted by Frank B View Post
    Your screenshot: Hmm.. funny, i use it on windows7 64 bit :-((
    I look at this tomorrow.
    just to prove it : Click image for larger version. 

Name:	wav2rawerrorpc.jpg 
Views:	69 
Size:	154.9 KB 
ID:	3302


    Quote Originally Posted by Frank B View Post
    Then, there seems to be a problem with AudioStartUsingSPI() and AudioStopUsingSPI ... if playing does not work for you, comment it out in the lib for the moment. Just found this issue some minutes ago.
    Tomorrow is the 13th... is this a sign ?
    OK, noted, thanks

  7. #32
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Quote Originally Posted by Frank B View Post
    Could you try both versions from the attachment,please ?

    I'll try to run it at work, tomorrow, maybe i can find the issue.

    Paul, do you have an idea ?
    Both work fine for me thank you

  8. #33
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    ... maybe i use another teensyduino version.. i attached both..
    Attached Files Attached Files

  9. #34
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    Quote Originally Posted by Pensive View Post
    Both work fine for me thank you
    Funny... i upload the exe again, maybe something was wrong with the first upload...

  10. #35
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Quote Originally Posted by Frank B View Post
    ... maybe i use another teensyduino version.. i attached both..
    You are a gentleman and a scholar. much obliged

  11. #36
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    like to help

  12. #37
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Thank you, all my files are loading into flash and verified OK, and it handled a hidden file with more than 8.3 filename just fine as well

    _delete_

  13. #38
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Hmmmm....

    I just replaced all my Audacity RAW files with the ones from wav2raw and now they are all screwed up. Length incorrect, lots of problems.

    I checked the playRAW function from the Audio library and cannot see the format info being read by the library.

    Code:
    bool AudioPlaySdRaw::play(const char *filename)
    {
    	stop();
    	AudioStartUsingSPI();
    	__disable_irq();
    	rawfile = SD.open(filename);
    	__enable_irq();
    	if (!rawfile) {
    		//Serial.println("unable to open file");
    		return false;
    	}
    	file_size = rawfile.size();
    	file_offset = 0;
    	//Serial.println("able to open file");
    	playing = true;
    	return true;
    }
    Code:
    void AudioPlaySdRaw::update(void)
    {
    	unsigned int i, n;
    	audio_block_t *block;
    
    	// only update if we're playing
    	if (!playing) return;
    
    	// allocate the audio blocks to transmit
    	block = allocate();
    	if (block == NULL) return;
    
    	if (rawfile.available()) {
    		// we can read more data from the file...
    		n = rawfile.read(block->data, AUDIO_BLOCK_SAMPLES*2);
    		file_offset += n;
    		for (i=n/2; i < AUDIO_BLOCK_SAMPLES; i++) {
    			block->data[i] = 0;
    		}
    		transmit(block);
    	} else {
    		rawfile.close();
    		AudioStopUsingSPI();
    		playing = false;
    	}
    	release(block);
    }
    just posted that from github
    solution - i'll go back to my old RAWs for now

    One other thing i noticed is the noise on the Audio bus when writing to the flash chip. Small thing, doesn't bother me in the slightest really. But worth mentioning.

  14. #39
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    UPDATE, hold that thought, SDcard suddenly stopped working and reported zero files. trying a reformat.

    Possibly because i did a Quickformat, not necessarily any problems yet.

  15. #40
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    Quote Originally Posted by Pensive View Post
    Hmmmm....

    I just replaced all my Audacity RAW files with the ones from wav2raw and now they are all screwed up. Length incorrect, lots of problems.

    I checked the playRAW function from the Audio library and cannot see the format info being read by the library.

    Code:
    bool AudioPlaySdRaw::play(const char *filename)
    {
    	stop();
    	AudioStartUsingSPI();
    	__disable_irq();
    	rawfile = SD.open(filename);
    	__enable_irq();
    	if (!rawfile) {
    		//Serial.println("unable to open file");
    		return false;
    	}
    	file_size = rawfile.size();
    	file_offset = 0;
    	//Serial.println("able to open file");
    	playing = true;
    	return true;
    }
    Code:
    void AudioPlaySdRaw::update(void)
    {
    	unsigned int i, n;
    	audio_block_t *block;
    
    	// only update if we're playing
    	if (!playing) return;
    
    	// allocate the audio blocks to transmit
    	block = allocate();
    	if (block == NULL) return;
    
    	if (rawfile.available()) {
    		// we can read more data from the file...
    		n = rawfile.read(block->data, AUDIO_BLOCK_SAMPLES*2);
    		file_offset += n;
    		for (i=n/2; i < AUDIO_BLOCK_SAMPLES; i++) {
    			block->data[i] = 0;
    		}
    		transmit(block);
    	} else {
    		rawfile.close();
    		AudioStopUsingSPI();
    		playing = false;
    	}
    	release(block);
    }
    just posted that from github
    solution - i'll go back to my old RAWs for now

    One other thing i noticed is the noise on the Audio bus when writing to the flash chip. Small thing, doesn't bother me in the slightest really. But worth mentioning.
    - Please look at the raw flash player... there is the header used.
    - The sdplayer can't play ulaw and the other formats. therfore it does not need any information about the format...
    - Then, there are not any writes to the sd-card. So it's unlikely that the card gets corrupted.
    - The noise.. i don't know. There is no Audiooutput... the i2s connection is not used (?!)
    Last edited by Frank B; 01-13-2015 at 12:13 PM.

  16. #41
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    Maybe it's better to change the extension to something like *.prw ("paul raw" )?

  17. #42
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    You read my mind, we should not use .raw for files that have a header. Simple common sense, because that is not what they are.

    We will get there! baby steps!

    _________________

    Now, I hate to bring problems people's way but i used wav2raw64 on my WAV files, all 44khz 16bit mono.

    All the RAW files are half as big as they should be.

    Here's a zip full of the the original WAVs, Audacity RAWs, and wav2raw RAWs, so you can have a look


    https://dl.dropboxusercontent.com/u/6452764/FrankB.zip

    I also tried converting my WAVs to stereo, and then running the tool, but to no avail, only 2.3MB of data where there should be 4.6

    edit: wav2raw32 gives same result

    Rgds

    J

  18. #43
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    Try wav2raw -16

    It's basically Pauls wav2sketch, with the same features and options. I simply modified the output. Instead of c-source the output are raw bytes.
    Without -16 it produces ulaw "compressed" audio. This has half of the size...exactly.

    Anyway, the player detects this and plays it correctly. The quality is not as perfect as 16bit, but sounds good. Maybe you want to give it a try ?

    EDIT: Just tried one single file, P2.raw from the "FrankB wav2raw64" directory from your upload. Flashed it, and it's ok. Equal to your "Source WAV"....
    Last edited by Frank B; 01-13-2015 at 10:25 PM.

  19. #44
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    I'm doing something stupid again...aren't I.

    I blame work, taking all my attention off the important things in life.

    =D

  20. #45
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,744
    No Problem.
    Hey, your sounds are great !

  21. #46
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    polyphony is looking pretty awesome.

    6 samples are peaking at 58%, so polyphony has effectively doubled by using the flash =D

    working great by the way, feels much snappier, and my ps/2 funny character problems seem to have evaporated

  22. #47
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Quote Originally Posted by Frank B View Post
    No Problem.
    Hey, your sounds are great !
    Mad Zach from DJ Tech Tools - finger drumming extraordinaire =D

  23. #48
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    8 samples all at once with envelopes = 76%

    9 samples = 88.7% peak

  24. #49
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    552
    Quote Originally Posted by Pensive View Post
    8 samples all at once with envelopes = 76%

    9 samples = 88.7% peak
    But more importantly than polyphony, it now _feels_ like a drum machine. I feel like i can bash away and it will respond - this was not the case previously. Thank you Frank! =D

    big smiles here
    Last edited by Pensive; 01-13-2015 at 11:38 PM.

  25. #50
    Senior Member
    Join Date
    Feb 2013
    Posts
    533
    Quote Originally Posted by Pensive View Post
    feels much snappier
    interesting. any chance you can quantify that? i only saw 1ms difference vs SDwav (well, last time i've tried. see my post #2 above)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •