Support and General Use > Audio Playback, Database and Playlists

How to delay at least 2 seconds between each song?


Hello everyone.
I want to use my iRiver iHP120 with Rockbox as a music source for recording MD discs.

The problem is an MD player needs at least 2 seconds of silence before starting a new song to create an auto-tracking correctly.

However, I could not find any existing setting or plugin to create at least two seconds gap between each song when playing with Rockbox.

Therefore, please could you suggest to me how to configure Rockbox, an existing plugin, or an idea to develop a plugin/code example to delay the amount of time before starting a new song.

Thank you so much.

 You could fake it with a playlist that had a bunch of short silent tracks between real tracks or else write your own plugin to add a pause between tracks, but I don't think there is a built in way to do this.

Also recording MD? What year is it :)

Hello @saratoga
Thanks for your suggestion. It is a nice tip. However, I only wonder if we have a way to automate a process.
I would be glad if you could point me to a code example which controls/interrupts playing of a song.
Then I can use it in a custom plugin code.

Thank you.

this should get you started..

--- Code: ---local function create_playlist(startdir, file_search, maxfiles)
--In lua you can define a function (locally) within another function
--find file function is passed to the get_files() fn
-- it allows us to do things with the match (accept or reject)
    function f_filedir_(name)
        if name:len() <= 2 and (name == "." or name == "..") then
            return false --reject
        if name:find(file_search) ~= nil then
            maxfiles = maxfiles -1
            if maxfiles < 1 then
                return true
            return true --accept
            return false --reject

    local norecurse  = false -- don't enter subdirs
    local f_finddir  = nil
    local f_findfile = f_filedir_
    local files = {}
    local dirs = {}
    local max_depth = 3

    dirs, files = get_files(startdir, norecurse, f_finddir, f_findfile, nil, max_depth, dirs, files)

    if #files > 0 then
        --"stop") -- for the pb example
        rb.playlist("create", scrpath .. "/", "playback.m3u8")

    for i = 1, #files do
        if(i > 1) then
            rb.playlist("insert_track", "/yourtransition_file.mp3" or "?") -- might need to check if exist first...
        rb.playlist("insert_track", string.match(files[i], "[^;]+") or "?")
    if #files > 0 then
        rb.playlist("start", 0, 0, 0) --start playing it

    for i=1, #dirs do dirs[i] = nil end -- empty table
    for i=1, #files do files[i] = nil end -- empty table
    --action_set_quit(false) -- for the pb example
end -- create_playlist

--- End code ---


Thanks for your code example, I appreciate it.
This must be fun but it haven't done with Lua script before.
It's time for me to start learning Lua.



[0] Message Index

Go to full version