Forum Rule: Always post complete source code & details to reproduce any issue!
Page 5 of 5 FirstFirst ... 3 4 5
Results 101 to 114 of 114

Thread: Now for MP3 with FS...

  1. #101
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    615
    Quote Originally Posted by Frank B View Post
    What is "DiskIOMB"?
    It's a small CLI that I use to test all of the different filesystems and the ongoing changes to them. I wanted a way to access the different filesystems without having to constantly upload modified sketches for each filesystem I was testing. Basically a unified way to access all of them. It started out with DiskIO which allows using a device name or number in a path spec to access a certain device. The name can be volume label like "/32GSDEXFAT/" or an assigned volume number like "0:" or "16:" etc...

    DiskIOMB is a version of MicroBox that I have modified for use with DiskIO found here:
    http://sebastian-duell.de/en/microbox/index.html
    It is an Arduino library that resembles a Linux shell. It's easy to add commands to it.

    Here is a link to my version of it:
    https://github.com/wwatson4506/DiskIO/tree/DiskIOV2

    This version play's wave files using two of the the files from Teensy-WavePlayer. I modified them pretty much the same as with Arduino-Teensy-Codec-Lib. You can play them from both built in and external SD cards, LittleFS memory devices and MSC USB devices. Hopefully when I am done with the changes it will also play all of the other codec types as well. I initially have it working now but ran into the problem with wave files that are larger the 60meg as it's using the Audio libraries version of waveplayer @mjs513 modified for FS. Not sure yet what the difference is. The large > 60meg files play with Teensy-WavePlayer but not the Audio library version.

    Anyway you can type help at the command line for a list of commands:
    Code:
    DiskIOMB
    
    The original version of microBox found here:
     http://sebastian-duell.de/en/microbox/index.html
    
    Initializing, please wait...
    
    Type 'help' for a list of commands...
    
    root@Teensy:/128GEXFAT>help
    
    Available Commands:
    
    clear  - Clear Screen (VT100 terminal Only)
    ld     - List available logical drives.
    ls     - List files and directories.
    cd     - Change logical drives and directories.
    mkdir  - Make directory.
    rmdir  - Remove directory (must be empty).
    rm     - Remove file.
    rename - Rename file or directory.
    cp     - Copy file (src dest).
    cat    - List file (Ascii only).
    play    - Play a Wav file. Press 'end' key to stop.(VT100 Terminal)
            - Cannot perform disk operation on same device WAV file 
            - is playing from. It will lock up DiskIOMB!
    
    All commands except clear and ld accept an optional drive spec.
    The drive spec can be /volume name/ (forward slashes required)
    or a logical drive number 0:-32: (colon after number required).
    Examples: cp /QPINAND/test.txt 1:test.txt
              cp test.txt test1.txt
    Both cp and rename require a space between arguments.
    One space is required between command and argument.
    Relative path specs and wilcards are supported.
    Example: ls 16:a/b/../*??*.cpp.
    
    root@Teensy:/128GEXFAT>

  2. #102
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,852
    @wwatson - have you tried to increase the audiomemory? AudioMemory(40) or might be related to something else. Actually only thing that I changed was instead of SD.open I use fs->open.

    Can you try your large file just using the waveplayer example in the Audio lib to see if yo have the same problem?

  3. #103
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    615
    Quote Originally Posted by mjs513 View Post
    @wwatson - have you tried to increase the audiomemory? AudioMemory(40) or might be related to something else. Actually only thing that I changed was instead of SD.open I use fs->open.

    Can you try your large file just using the waveplayer example in the Audio lib to see if yo have the same problem?
    I'll try it now...

    EDIT:
    Code:
    root@Teensy:/128GEXFAT/Music>ls
    Volume Label: 128GEXFAT
    Full Path: /128GEXFAT/Music
    armaged.wav                                 56863276            December 05 2021 08:59:46
    Daddy's_Little_Man.wav                      40900890            December 05 2021 09:00:34
    DeffLepardAnimal.wav                        43025728            December 05 2021 09:01:34
    ThePaperboysMolinos.wav                     35639166            December 05 2021 09:02:20
    ThePaperboysMolinosI'veJustSeenaFace.wav    36381082            December 05 2021 09:02:54
    YoureLazyJimmyBarnesJoeBonamassa.wav       102878370            December 05 2021 08:59:22
    WhateverYouWant.wav                         60148386            December 04 2021 19:14:08
    Free Space: 123264565248
    root@Teensy:/128GEXFAT/Music>
    Increased to:
    Code:
    AudioMemory(40)
    The files in blue play the two in red do not. Tested on the PC and both files in red play

    At this point I do not understand what the size of the file has to do with it.
    Last edited by wwatson; 12-05-2021 at 05:14 PM. Reason: More Info...

  4. #104
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,578
    They probably use a newer header than the waveplayer supports.
    Microsoft-typical (not sure about the history - i think they just took the apple aiff-header and senseless modified it(?) - as usual for microsoft) they have several header versions.
    PLUS there are several "unofficial" versions, used by 3rd party tools.

    If you find a way to send me the two problematic file, I can take a look at their headers.

  5. #105
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,852
    In addition to what Frank said you can download Audacity to make sure they are at 44100hz (ran into that as well) and then resave the wav file that always seems to work for the files I use

  6. #106
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    615
    @Frank - Will try to send them as zips. @mjs513 - Will check them with Audacity.

    Thanks guys

  7. #107
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    615
    Quote Originally Posted by mjs513 View Post
    In addition to what Frank said you can download Audacity to make sure they are at 44100hz (ran into that as well) and then resave the wav file that always seems to work for the files I use
    Well that fixed the problem Both files at 48000Hz. Used Audacity to change the bit rate to 44100 (once I finally figured how to).

    Both files play now

    Thanks Mike. I learn something new every day...

  8. #108
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,852
    Quote Originally Posted by wwatson View Post
    Well that fixed the problem Both files at 48000Hz. Used Audacity to change the bit rate to 44100 (once I finally figured how to).

    Both files play now

    Thanks Mike. I learn something new every day...
    Learned the same way as you - think Frank pointed that out to me a long time ago as well. But glad you got it working

  9. #109
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,980
    Quote Originally Posted by wwatson View Post
    Well that fixed the problem Both files at 48000Hz. Used Audacity to change the bit rate to 44100 (once I finally figured how to).

    Both files play now

    Thanks Mike. I learn something new every day...


    Wonder if the software could/should be updated, to when you say play X.wav if it is going to fail due to new format or wrong bit rate, that it might return some error message to inform the user...

  10. #110
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    615
    Quote Originally Posted by KurtE View Post


    Wonder if the software could/should be updated, to when you say play X.wav if it is going to fail due to new format or wrong bit rate, that it might return some error message to inform the user...
    That's probably a good thought. When I was testing I added Serial.printf's to the stop() and update() functions. When the wave file failed to play it went into an endless loop in update() spewing "update()...". Had to power cycle to get it to stop.

  11. #111
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,578
    Teensyduino doesn't allow errormessages. Only Serial.prints (with all its disadvantages)
    But, right, play() could at least return an error - an enum or similar.

  12. #112
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    615
    Quote Originally Posted by Frank B View Post
    Teensyduino doesn't allow errormessages. Only Serial.prints (with all its disadvantages)
    But, right, play() could at least return an error - an enum or similar.
    Started horsing around with this. You just blew what did out of the water Did not realize this was a no-no.

    Anyway made a couple of small changes to play_sd_wav.cpp. Added a couple of lines to parse_format(): Serial error prints. and in consume() I added this:
    Code:
    	  // check & extract key audio parameters
    	  case STATE_PARSE2:
    		len = data_length;
    		if (size < len) len = size;
    		memcpy((uint8_t *)header + header_offset, p, len);
    		header_offset += len;
    		buffer_offset += len;
    		data_length -= len;
    		if (data_length > 0) return false;
    		if (parse_format()) {
    			//Serial.println("audio format ok");
    			p += len;
    			size -= len;
    			data_length = 8;
    			header_offset = 0;
    			state = STATE_PARSE3;
    			goto start;
    		}else { // Added for invalid bit rate
    			stop();
    			return false;
    		}
    The result:
    Code:
    DiskIOMB
    
    The original version of microBox found here:
     http://sebastian-duell.de/en/microbox/index.html
    
    Initializing, please wait...
    
    Type 'help' for a list of commands...
    
    root@Teensy:/128GEXFAT>play WhateverYouWant48000.wav
    Playing: /WhateverYouWant48000.wav
    Error: Unused WAV File Bit Rate -> 48000Hz.
    root@Teensy:/128GEXFAT>play Music/WAV/WhateverYouWant.wav     
    Playing: /Music/WAV/WhateverYouWant.wav
    root@Teensy:/128GEXFAT>

  13. #113
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    615
    @FrankB - Just updated Teensy-WavePlayer to your latest. As far as installation do I need t overwrite "Audio.h" in the Tennsyduino Audio library? or will it override it if in the Arduino/libraries folder?

    Just looking for proper installation and usage...

    Thanks

  14. #114
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,578
    It all does not matter much. It just needs the #include.
    You can add it to your Sketch, too (after #include <Audio.h>)

    You can append the keywords, too: https://github.com/FrankBoesing/Teen...n/keywords.txt
    Last edited by Frank B; 12-08-2021 at 10:11 AM. Reason: add keywords.txt

Posting Permissions

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