1function test = dr_test_input(test) 2 3%% t = dr_test_input(t) 4% 5% Create tone data file for playback & record on real device or 6% for algorithm simulation. 7% 8% Input parameters 9% t.fs - sample rate 10% t.bits_in - signal word length 11% t.ch - mix test signal to channel ch 12% t.nch - total number of channels in data 13% 14% Output parameters 15% t.fn_in - created input file name 16% t.fn_out - proposed output file name for captured output 17% t.f - test signal frequency 18% t.tl - tone length in seconds 19% t.ts - tone start time 20% t.tr - tone gain ramp length in seconds 21% t.ti - ignore time from tone start and end, must be ti > tr 22% t.a - tone amplitude (lin) 23% t.a_db - tone amplitude (dB) 24% t.mark_t - length of marker tone in seconds 25% t.mark_a - amplitude max of marker tone (lin) 26% t.mark_a_db - amplitude max of marker tone (dB) 27% 28 29%% 30% Copyright (c) 2016, Intel Corporation 31% All rights reserved. 32% 33% Redistribution and use in source and binary forms, with or without 34% modification, are permitted provided that the following conditions are met: 35% * Redistributions of source code must retain the above copyright 36% notice, this list of conditions and the following disclaimer. 37% * Redistributions in binary form must reproduce the above copyright 38% notice, this list of conditions and the following disclaimer in the 39% documentation and/or other materials provided with the distribution. 40% * Neither the name of the Intel Corporation nor the 41% names of its contributors may be used to endorse or promote products 42% derived from this software without specific prior written permission. 43% 44% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 45% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 46% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 47% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 48% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 49% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 50% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 51% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 52% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 53% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 54% POSSIBILITY OF SUCH DAMAGE. 55% 56% Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> 57% 58 59%% Reference: AES17 6.2.3 Frequency response 60 61if nargin < 1 62 fprintf('Warning, using default parameters!\n'); 63 test.fs = 48e3; test.bits_in=32; test.ch=1; test.nch=1; 64end 65 66if test.ch == 0 67 test.ch = 1+round(rand(1,1)*(test.nch-1)); % Test random channel 1..Nch 68end 69 70fprintf('Using parameters Fs=%.1f, bits=%d, ch=%d, Nch=%d\n', ... 71 test.fs/1e3, test.bits_in, test.ch, test.nch ); 72 73%% Test tone parameters 74test.fn_in = sprintf('dr_test_in.%s', test.fmt); 75test.fn_out = sprintf('dr_test_out.%s', test.fmt); 76test.f = 997; 77test.a_db = -60; 78test.a = 10^(test.a_db/20); 79test.is = 1.0; % Ignore signal from tone start 80test.ie = 20e-3; % Ignore signal from tone end 81test.tr = 10e-3; % Gain ramp time for tones 82test.sm = 3; % Seek start marker from 3s from start 83test.em = 3; % Seek end marker from 3s from end 84test.mt = 0.3; % Error if marker positions delta is greater than 0.3s 85test.tc = 25; % Min. 20 cycles of sine wave for a frequency 86test.tl = 3; % 3 seconds tone 87 88%% Mix the input file for test and write output 89test = mix_sweep(test); 90 91end 92