Audio-TinySoundFont

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "develop" : {
         "requires" : {
            "Dist::Milla" : "v1.0.21",
            "Test::Pod" : "1.41"
         }
      },
      "runtime" : {
         "requires" : {
            "Moo" : "2.000",
            "Try::Tiny" : "0",
            "Types::Standard" : "0",
            "autodie" : "0",
            "perl" : "5.014000"
         }
      },
      "test" : {
         "requires" : {
            "Test::More" : "0.96"
         }
      }

META.yml  view on Meta::CPAN

no_index:
  directory:
    - eg
    - examples
    - inc
    - share
    - t
    - xt
requires:
  Moo: '2.000'
  Try::Tiny: '0'
  Types::Standard: '0'
  autodie: '0'
  perl: '5.014000'
resources:
  bugtracker: https://github.com/atrodo/Audio-TinySoundFont/issues
  homepage: https://github.com/atrodo/Audio-TinySoundFont
  repository: https://github.com/atrodo/Audio-TinySoundFont.git
version: '0.12'
x_contributors:
  - 'Jon Gentle <atrodo@atrodo.org>'

Makefile.PL  view on Meta::CPAN

  "AUTHOR" => "Jon Gentle <cpan\@atrodo.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "Audio-TinySoundFont",
  "LICENSE" => "artistic_2",
  "MIN_PERL_VERSION" => "5.014000",
  "NAME" => "Audio::TinySoundFont",
  "PREREQ_PM" => {
    "Moo" => "2.000",
    "Try::Tiny" => 0,
    "Types::Standard" => 0,
    "autodie" => 0
  },
  "TEST_REQUIRES" => {
    "Test::More" => "0.96"
  },
  "VERSION" => "0.12",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "Moo" => "2.000",
  "Test::More" => "0.96",
  "Try::Tiny" => 0,
  "Types::Standard" => 0,
  "autodie" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};
  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

cpanfile  view on Meta::CPAN

requires 'perl', '5.014000';

requires 'autodie';
requires 'Moo', '2.000';
requires 'Try::Tiny';
requires 'Types::Standard';

on test => sub {
    requires 'Test::More', '0.96';
};

lib/Audio/TinySoundFont.pm  view on Meta::CPAN

package Audio::TinySoundFont;

use v5.14;
use warnings;
our $VERSION = '0.12';

use autodie;
use Carp;
use Try::Tiny;
use Scalar::Util qw/blessed/;

use Moo;
use Types::Standard qw/ArrayRef HashRef GlobRef Str Int Num InstanceOf/;

use Audio::TinySoundFont::XS;
use Audio::TinySoundFont::Preset;
use Audio::TinySoundFont::Builder;

has _tsf => (

lib/Audio/TinySoundFont/Preset.pm  view on Meta::CPAN

package Audio::TinySoundFont::Preset;

use v5.14;
use warnings;
our $VERSION = '0.12';

use autodie;
use Carp;
use Try::Tiny;
use Moo;
use Types::Standard qw/Int Str InstanceOf/;

has soundfont => (
  is       => 'ro',
  isa      => InstanceOf ['Audio::TinySoundFont'],
  required => 1,
);

has index => (

t/010-build.t  view on Meta::CPAN

use strict;
use Test::More;
use FindBin qw/$Bin/;
use Audio::TinySoundFont;

use autodie;
use Try::Tiny;

my $sf2_file = "$Bin/tiny.sf2";
open my $sf2_fh, '<', $sf2_file;
my $sf2 = do { local $/; <$sf2_fh> };
$sf2_fh->seek( 0, 0 );

# Scalar (file name)
{
  my $tsf = try { Audio::TinySoundFont->new($sf2_file) };

t/011-note_on.t  view on Meta::CPAN

use strict;
use Test::More;
use FindBin qw/$Bin/;
use Audio::TinySoundFont;

use autodie;
use Try::Tiny;

{
  my $tsf = Audio::TinySoundFont->new("$Bin/tiny.sf2");
  is( $tsf->is_active, '', 'Fresh instance is inactive' );

  $tsf->note_on('');
  is( $tsf->is_active, 1, 'note_on makes it active' );
  is( $tsf->active_voices, 1, 'note_on sets the active_voices correctly');

  $tsf->note_off('');

t/012-attrs.t  view on Meta::CPAN

use strict;
use Test::More;
use FindBin qw/$Bin/;
use Audio::TinySoundFont;

use autodie;
use Try::Tiny;
use List::Util qw/sum/;

my $sf2_file = "$Bin/tiny.sf2";
my $tsf      = Audio::TinySoundFont->new($sf2_file);

sub p10
{
  my @samples = reverse sort unpack 's<*', shift;
  splice( @samples, int( @samples * .1 ) );
  return sum(@samples) / scalar(@samples);

t/020-preset.t  view on Meta::CPAN

use strict;
use Test::More;
use Try::Tiny;
use FindBin qw/$Bin/;
use List::Util qw/sum/;
use Audio::TinySoundFont;

my $tsf = Audio::TinySoundFont->new("$Bin/tiny.sf2");
isnt( $tsf, undef, 'Can create a new object' );

# By Name
{
  my $preset = $tsf->preset('test');

t/021-render.t  view on Meta::CPAN

use strict;
use Test::More;
use Try::Tiny;
use FindBin qw/$Bin/;
use List::Util qw/sum/;
use Audio::TinySoundFont;

my $tsf = Audio::TinySoundFont->new("$Bin/tiny.sf2");
isnt( $tsf, undef, 'Can create a new object' );

my $preset = $tsf->preset('');
isnt( $preset, undef, 'Can get a preset' );

t/030-builder.t  view on Meta::CPAN

use strict;
use Test::More;
use FindBin qw/$Bin/;
use Audio::TinySoundFont;

use autodie;
use List::Util qw/sum/;
use Try::Tiny;

{
  my $tsf      = Audio::TinySoundFont->new("$Bin/tiny.sf2");
  my $SR       = $tsf->SAMPLE_RATE;
  my @script_a = (
    {
      preset => '',
      note   => 59,
    },
    {

t/040-unpack.t  view on Meta::CPAN

use strict;
use Test::More;
use FindBin qw/$Bin/;
use Audio::TinySoundFont;

use autodie;
use Try::Tiny;

my $tsf = Audio::TinySoundFont->new("$Bin/tiny.sf2");
{
  $tsf->note_on('');
  $tsf->note_off('');

  my $samples = $tsf->render;
  is( $tsf->is_active, '', 'note_off after 1 second does make it inactive' );

  $tsf->note_on('');



( run in 0.813 second using v1.01-cache-2.11-cpan-05444aca049 )