packages/audio-pack/index.js
function samples (samplesPath, obj) {
  var files = fs.readdirSync(samplesPath).reduce(function (d, name) {
    var ext = audioExt(name)
    if (ext) d[name.substring(0, name.length - ext.length)] = name
    return d
  }, {})
  var names = Object.keys(files)
  var prefix = sharedStart(names)
  var len = prefix.length
  var samples = names.reduce(function (s, name) {
    s[name.substring(len)] = encode(path.join(samplesPath, files[name]))
    return s
  }, {})
  return obj ? samples : JSON.stringify(samples, null, 2)
}
function samples (samplesPath, obj) {
  var files = fs.readdirSync(samplesPath).reduce(function (d, name) {
    var ext = audioExt(name)
    if (ext) d[name.substring(0, name.length - ext.length)] = name
    return d
  }, {})
  var names = Object.keys(files)
  var prefix = sharedStart(names)
  var len = prefix.length
  var samples = names.reduce(function (s, name) {
    s[name.substring(len)] = encode(path.join(samplesPath, files[name]))
    return s
  }, {})
  return obj ? samples : JSON.stringify(samples, null, 2)
}
function samples ( samplesPath , obj ) { var files = fs . readdirSync ( samplesPath ) . reduce ( function ( d , name ) { var ext = audioExt ( name ) if ( ext ) d [ name . substring ( 0 , name . length - ext . length ) ] = name return d } , { } ) var names = Object . keys ( files ) var prefix = sharedStart ( names ) var len = prefix . length var samples = names . reduce ( function ( s , name ) { s [ name . substring ( len ) ] = encode ( path . join ( samplesPath , files [ name ] ) ) return s } , { } ) return obj ? samples : JSON . stringify ( samples , null , 2 ) }
Return a JSON with the audio files from a path encoded in base64
Return a JSON with the audio files from a path encoded in base64