xLightsSequencer / xLights

xLights is a sequencer for Lights. xLights has usb and E1.31 drivers. You can create sequences in this object oriented program. You can create playlists, schedule them, test your hardware, convert between different sequencers.
GNU General Public License v3.0
548 stars 208 forks source link

Add option to add pre/post silence to the audio file. #4594

Closed cybercop23 closed 1 month ago

cybercop23 commented 3 months ago

Users need to have FFMPEG installed, if not, they will get prompted to install it.

dkulp commented 3 months ago

IMO - calling out to ffmpeg for this is not an option. It's not likely to be installed on any of the machines or in the paths on Mac/Windows. Using the libav libraries directly to accomplish this would be OK since we already include all of that.

cybercop23 commented 3 months ago

So long ffmped is installed on the Windows system, and in the file path, it will call it and run it. I didn't have it installed and just installed it and it ran. I couldn't test it on a Mac, but just opening a command prompt and typing the same string, produced the output. There may be an issue if/how Mac will allow an external app to be called. I tried doing it with the libs themselves.. that's why Ubuntu failed, cuz I left them in, eventhough I wasn't using them (they are removed now), but couldn't get it to work. There seems to be some compatability issues with the API between diff versions. It was either creating an empty file, with 5+ or 1Gb+ with the old. So gave up on that and just used the exec itself. Not a lot of folks would need/use this, but those that do, will have to install FFMPEG, just like Vamp, if they want to use it.

keithsw1111 commented 3 months ago

If we are going to do this we should not be relying on external tools. There is already code in xlights for editing audio files ... this should work the same way. We have been working for years to eliminate these sort of dependencies.

cybercop23 commented 3 months ago

If we are going to do this we should not be relying on external tools. There is already code in xlights for editing audio files ... this should work the same way. We have been working for years to eliminate these sort of dependencies.

Scott mentioned something about you doing something to trim the audio (which is already a suggested enhancement) but I can't find it. Can you please point me in the right direction?

AzGilrock commented 3 months ago

People should just use Audacity…Don’t need xLights to do everything

cybercop23 commented 3 months ago

People should just use Audacity…Don’t need xLights to do everything

Yeah.. felt that way at first too, but then I tried to use it and sucked for something so simple. I think triming may be more of a request than adding...

keithsw1111 commented 3 months ago

It’s in the tools menu

On 8 Jun 2024, at 7:07 AM, AlexB @.***> wrote:



If we are going to do this we should not be relying on external tools. There is already code in xlights for editing audio files ... this should work the same way. We have been working for years to eliminate these sort of dependencies.

Scott mentioned something about you doing something to trim the audio (which is already a suggested enhancement) but I can't find it. Can you please point me in the right direction?

— Reply to this email directly, view it on GitHubhttps://github.com/xLightsSequencer/xLights/pull/4594#issuecomment-2155553207, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACOOXKDYJTHJIXAY6AWZYEDZGIOIPAVCNFSM6AAAAABI5XEP5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGU2TGMRQG4. You are receiving this because you commented.Message ID: @.***>

cybercop23 commented 3 months ago

Thanks. Yeah.. that's what I started digging into. Seems very close to what we are after.

cybercop23 commented 3 months ago

@keithsw1111 hoping you can take a peek at this issue... Using your example xaudio from the comments in the code, I tried to do a simple test and I get an error on avformat_write_header, rc=-22. It creates a 0 byte file in the right directory but nothing is written to it. I tried to allocate_conext before and still the same issue. I'm thinking the sample code should run and be able to produce some output. Looking at that you have supported, I think we can use it to achieve the pre/post silence and I can just leave the new SequenceSettings in place and replace the systemcall with the AudioManager that has the "right" vector defined.

cybercop23 commented 3 months ago

Okay... so I went back and tried to use the RPP file and I get the same thing. So whatever we have now is broken and not working. We either need to fix it (above my ability right now) or pull it out.

2024-06-13 13:03:28,731 19728 log_base [ERROR] Error writing file header

Here's my logs from using the MP3 from Google Play with the respective RPP file.

2024-06-13 13:03:22,370 19728 log_base [DEBUG] Prepare audio: C:\Users\Alex\Documents\Sandbox\The Greatest Show Google Play.RPP. 2024-06-13 13:03:22,370 19728 log_base [DEBUG] Target file: C:\Users\Alex\Documents\Sandbox\01 The Greatest Show google play edited.mp3 2024-06-13 13:03:22,370 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 1.000 Length: 5.500 Target Pos: 0.000 Fade In: 0.750 Fade Out: 0.500 Volume: 0.787 2024-06-13 13:03:22,370 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 13.800 Length: 3.000 Target Pos: 5.000 Fade In: 0.500 Fade Out: 0.500 Volume: 0.787 2024-06-13 13:03:22,370 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 28.786 Length: 6.291 Target Pos: 7.500 Fade In: 0.500 Fade Out: 0.543 Volume: 0.787 2024-06-13 13:03:22,370 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 47.006 Length: 9.135 Target Pos: 13.249 Fade In: 0.543 Fade Out: 0.283 Volume: 0.787 2024-06-13 13:03:22,370 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 55.857 Length: 3.400 Target Pos: 22.100 Fade In: 0.283 Fade Out: 0.217 Volume: 3.141 2024-06-13 13:03:22,370 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 59.040 Length: 3.183 Target Pos: 25.283 Fade In: 0.217 Fade Out: 0.358 Volume: 0.685 2024-06-13 13:03:22,371 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 61.865 Length: 3.625 Target Pos: 28.108 Fade In: 0.358 Fade Out: 0.117 Volume: 3.141 2024-06-13 13:03:22,371 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 65.374 Length: 2.953 Target Pos: 31.617 Fade In: 0.117 Fade Out: 0.200 Volume: 0.717 2024-06-13 13:03:22,371 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 68.127 Length: 3.550 Target Pos: 34.370 Fade In: 0.200 Fade Out: 0.130 Volume: 2.462 2024-06-13 13:03:22,371 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 71.547 Length: 2.830 Target Pos: 37.790 Fade In: 0.130 Fade Out: 0.010 Volume: 1.303 2024-06-13 13:03:22,371 19728 log_base [DEBUG] Source file: 01 - The Greatest Show google play.mp3 Source Pos: 74.377 Length: 227.151 Target Pos: 40.620 Fade In: 0.010 Fade Out: 0.010 Volume: 0.717 2024-06-13 13:03:27,177 19728 log_base [DEBUG] Constructing xLightsVamp 2024-06-13 13:03:27,177 19728 log_base [DEBUG] Audio Manager Constructor start 2024-06-13 13:03:27,177 19728 log_base [DEBUG] Audio Manager Constructor: Loading media file. 2024-06-13 13:03:27,256 19728 log_base [DEBUG] Getting track metrics. 2024-06-13 13:03:27,256 19728 log_base [INFO] av_frame_alloc okay 2024-06-13 13:03:27,541 19728 log_base [INFO] Track Size: 13324668, Time Base Den: 44100 => Length 302146ms 2024-06-13 13:03:27,551 19728 log_base [DEBUG] Preparing to load song data. 2024-06-13 13:03:27,551 3180 log_base [DEBUG] DoLoadAudioData: Doing load of song data. 2024-06-13 13:03:27,551 19728 log_base [DEBUG] Opening audio device. (null) 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Result '' 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Audio device opened -> Device: 2. 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Current audio driver directsound 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Output devices 2. Input devices 0. 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Audio device '' opened 2. Device specification: 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Audio device status (2) Paused 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Size Asked 4096 Received 4096 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Channels Asked 2 Received 2 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Format Asked 0x8010 Received 0x8010 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Bitsize Asked 16 Received 16 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Float Asked False Received False 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Big Endian Asked False Received False 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Signed Asked True Received True 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Frequency Asked 44100 Received 44100 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Padding Asked 0 Received 0 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Samples Asked 1024 Received 1024 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Silence Asked 0 Received 0 2024-06-13 13:03:27,562 19728 log_base [DEBUG] SDL Audio Pause on device 2. 2024-06-13 13:03:27,562 19728 log_base [DEBUG] SDL initialized output: '' 2024-06-13 13:03:27,562 19728 log_base [DEBUG] SDL Audio Added: id: 0, device 2, rate: 44100, len: 53298672, lengthMS: 302146, trackSize: 13324668. 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Audio Manager Constructor: Media file loaded. 2024-06-13 13:03:27,562 19728 log_base [DEBUG] Audio Manager Constructor: Skipping preparing frame data as timing not known yet. 2024-06-13 13:03:27,562 19728 log_base [INFO] Audio file loaded. 2024-06-13 13:03:27,562 19728 log_base [INFO] Filename: C:\Users\Alex\Documents\Sandbox\The Greatest Show.mp3 2024-06-13 13:03:27,562 19728 log_base [INFO] Title: The Greatest Show 2024-06-13 13:03:27,562 19728 log_base [INFO] Album: The Greatest Showman (Original Motion Picture Soundtrack) 2024-06-13 13:03:27,562 19728 log_base [INFO] Artist: Keala Settle 2024-06-13 13:03:27,562 19728 log_base [INFO] Length: 302146ms 2024-06-13 13:03:27,562 19728 log_base [INFO] Channels 2, Bits: 4, Rate 44100 2024-06-13 13:03:27,562 19728 log_base [DEBUG] New file will: 2024-06-13 13:03:27,562 19728 log_base [DEBUG] have 11808705 samples. 2024-06-13 13:03:27,562 19728 log_base [DEBUG] be 267.771 seconds long. 2024-06-13 13:03:27,571 19728 log_base [DEBUG] Setting default frame interval for 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:27,571 19728 log_base [DEBUG] Changing frame interval to 20 2024-06-13 13:03:27,571 19728 log_base [DEBUG] GetLeftData waiting for data to be loaded. 2024-06-13 13:03:27,571 23320 log_base [INFO] DoPrepareFrameData: Start processing audio frame data. 2024-06-13 13:03:27,571 23320 log_base [INFO] DoPrepareFrameData: Got mutex. 2024-06-13 13:03:27,571 23320 log_base [INFO] DoPrepareFrameData: waiting for audio data to load. 2024-06-13 13:03:27,672 19728 log_base [DEBUG] GetLeftData waiting for data to be loaded. 2024-06-13 13:03:27,772 19728 log_base [DEBUG] GetLeftData waiting for data to be loaded. 2024-06-13 13:03:27,872 19728 log_base [DEBUG] GetLeftData waiting for data to be loaded. 2024-06-13 13:03:27,878 3180 log_base [DEBUG] DoLoadAudioData: Song data loaded in 327. Read: 13324668 2024-06-13 13:03:28,572 23320 log_base [INFO] DoPrepareFrameData: Data is loaded. 2024-06-13 13:03:28,602 23320 log_base [INFO] Length 302146ms 2024-06-13 13:03:28,602 23320 log_base [INFO] Interval 20ms 2024-06-13 13:03:28,602 23320 log_base [INFO] Samples per frame 882 2024-06-13 13:03:28,602 23320 log_base [INFO] Frames 15108 2024-06-13 13:03:28,602 23320 log_base [INFO] Total samples 13325256 2024-06-13 13:03:28,676 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,678 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,678 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,680 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,681 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,681 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,682 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,683 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,683 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,684 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,684 19728 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:03:28,718 19728 log_base [DEBUG] Creating audio file C:\Users\Alex\Documents\Sandbox\01 The Greatest Show google play edited.mp3. 2024-06-13 13:03:28,731 19728 log_base [ERROR] Error writing file header 2024-06-13 13:03:29,451 23320 log_base [INFO] DoPrepareFrameData: Audio frame data processing complete in 1879. Frames: 15108 2024-06-13 13:03:35,444 19728 log_base [DEBUG] AudioManager::~AudioManager 2024-06-13 13:03:35,444 19728 log_base [DEBUG] SDL Audio Stop on device 2. 2024-06-13 13:03:35,445 19728 log_base [DEBUG] SDL Audio Removed: id: 0 device: 2. 2024-06-13 13:03:35,458 19728 log_base [DEBUG] AudioManager::~AudioManager Done 2024-06-13 13:03:38,717 19728 log_base [DEBUG] Viewing log file C:\Users\Alex\AppData\Roaming/xLights_l4cpp.log.

computergeek1507 commented 3 months ago

It might just be a Unicode issue on windows. Are you testing on MacOS or Windows?

cybercop23 commented 3 months ago

It might just be a Unicode issue on windows. Are you testing on MacOS or Windows?

The above was on Windows and my original dev using FFMPEG was Windows too. I jusst tried Mac using TestFlight and same exact error.. so I'm thining FFMPEG upgrade may have done it, but that's point that nobody really uses that functionality

2024-06-13 13:32:32,000 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,000 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,001 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,001 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,002 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,002 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,003 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,003 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,003 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,004 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,004 8603012096 log_base [DEBUG] Processing sample from 01 - The Greatest Show google play.mp3. 2024-06-13 13:32:32,026 8603012096 log_base [DEBUG] Creating audio file /Volumes/documents/Alex/2024/Christmas/01 The Greatest Show google play edited.mp3. 2024-06-13 13:32:32,043 8603012096 log_base [ERROR] Error writing file header 2024-06-13 13:32:32,370 6375223296 log_base [INFO] DoPrepareFrameData: Audio frame data processing complete in 1479. Frames: 15108 2024-06-13 13:32:33,742 8603012096 log_base [DEBUG] AudioManager::~AudioManager 2024-06-13 13:32:33,742 8603012096 log_base [DEBUG] SDL Audio Stop on device 2. 2024-06-13 13:32:33,742 8603012096 log_base [DEBUG] SDL Audio Removed: id: 0 device: 2. 2024-06-13 13:32:33,755 8603012096 log_base [DEBUG] AudioManager::~AudioManager Done