Can I play wav files ?



  • I made this for Reaper in Lua script and would like to port it to HISE so it can be used in any DAW.
    I would like some advice if you think this is possible, thanks.
    https://forum.cockos.com/showthread.php?t=252609

    alt text

    It basically just imports the sections from the wav file to fit the same sections in the chord/bar sheet.
    The chord/bar sheet will follow the DAW time signature.

    The wav will have a region/chord csv with the section name/chord, time position and section color in the wav:

    #,Name,Start,End,Length,Color
    R1,C,1.1.00,3.1.00,2.0.00,FF80C0
    R2,C,3.1.00,7.1.00,4.0.00,3776EB
    R3,C#,7.1.00,11.1.00,4.0.00,3776EB
    R4,D,11.1.00,15.1.00,4.0.00,3776EB
    R5,D#,15.1.00,19.1.00,4.0.00,3776EB
    

    So it will need to playback the sample section of the wav file from the local disk while adjusting the tempo to match the host.
    Any info and suggestion would be much appreciated.



  • No go...



  • @MusoCity really still not clear what you want HISE to do for you...dynamically import wav files?



  • Play back a sample section of the source wav.
    In the pic below the top track is the source file,
    the second track is chord sections of the track being played back.
    These will playback @ DAW bpm.
    Full Screen
    alt text



  • @MusoCity HISE can't play back audio that's in a DAW it can only playback audio that is present in the plugin.



  • @d-healey said in Can I play wav files ?:

    @MusoCity HISE can't play back audio that's in a DAW it can only playback audio that is present in the plugin.

    The files are in a folder on the hard drive, the pic is just to show what I need, the DAW is playing them direct from the hard drive, this is what I need HISE to do, play a C section, play an Am section, play a G section........ etc
    the csv gives the time location and length in the wav.
    "it can only playback audio that is present in the plugin." "in" is that from a sample source on disk ?

    alt text
    alt text



  • @MusoCity HISE can only play back files that you have mapped in a sampler or loaded into an audio loop player module. It can't play arbitrary files of the user's choosing.



  • Do you know of anything else ?
    I tried https://www.osar.fr/protoplug/ but could not get the wav to play with the supplied Lua script:

    --[[
    name: soundfile test
    description: A simple demo that plays an audio file.
    author: osar.fr
    --]]
    
    require "include/protoplug"
    
    local path = "C:\\Temp\\Drums120bpm.wav"
    local wave, len
    
    -- 'prepareToPlay' will be triggered when the host sample rate is known,
    -- so we can load sound files with automatic sample rate conversion:
    plugin.addHandler('prepareToPlay', function()
    	local readr = juce.AudioFormatReader(path)
    	if readr==nil then error ("can't open wave: "..path) end
    	wave, len = readr:readToFloat(2) -- require 2 channels
    end)
    
    polyGen.initTracks(8)
    
    function polyGen.VTrack:noteOn(note, vel, ev)
    	self.playing = true
    	self.wavepos = 0
    end
    
    function polyGen.VTrack:noteOff(note, ev)
    	self.playing = false
    end
    
    function polyGen.VTrack:addProcessBlock(samples, smax)
    	for i = 0,smax do
    		if self.playing and self.wavepos < len then
    			self.wavepos = self.wavepos + 1
    			samples[0][i] = samples[0][i] + wave[0][self.wavepos] -- left
    			samples[1][i] = samples[1][i] + wave[1][self.wavepos] -- right
    		end
    	end
    end
    


  • If C++ is an option I'd recommend doing it directly with JUCE. If you can do it as a standalone app instead of a plugin then it might be something you could do with Electron.



  • If we all knew C++ we wouldn't be here 😞
    They have to playback in sync with the other DAW tracks so yeah needs to be in a VST.
    Maybe I'll just forget about it and go down the beach 🙂



  • @MusoCity I can recommend a good C++ developer if you want to hire it out.



  • Now I had a look at HISE and there is an Audio Loop Player.
    Can I drop a long wav in, set the Loop to 2 or 4 bars, set the sample pos start sample pos end, assign that to a midi chord input. So when a C chord is played it will loop that section of the wav , then C# chord will loop another section and so on ?

    alt text


Log in to reply
 

12
Online

1.3k
Users

4.3k
Topics

38.6k
Posts